package worker;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import org.objectweb.proactive.ActiveObjectCreationException;
import org.objectweb.proactive.core.body.migration.MigrationException;
import org.objectweb.proactive.core.node.NodeException;

public interface Manager {
	
	
	public Master getMaster () throws ActiveObjectCreationException, NodeException, MigrationException;
	
	public void setMaster (Master m);
	
	public void setBackups (ArrayList<Backup> list);
	
	public void restoreMaster () throws ActiveObjectCreationException, NodeException, MigrationException;
	
	public void createMaster(int nbBackup);
	
	public void add2Master (ManagerImpl m) throws ActiveObjectCreationException, NodeException, MigrationException;
			
	public void addBackup (Master m) throws ActiveObjectCreationException, NodeException, MigrationException;

	public void addBackup (int index, Master m) throws ActiveObjectCreationException, NodeException, MigrationException;

	public void updateMaster () throws ActiveObjectCreationException, NodeException, MigrationException;
	
	/**
	 * Update du master et des managers chez tous les workers (Manager)
	 * @throws MigrationException 
	 * @throws NodeException 
	 * @throws ActiveObjectCreationException 
	 */
	public void updateBackup () throws ActiveObjectCreationException, NodeException, MigrationException;
	
	public void init () throws ActiveObjectCreationException, NodeException, MigrationException;

	public void connectTo (ManagerImpl ref) throws ActiveObjectCreationException, IOException, NodeException, MigrationException;
	
	public int getCurrentNbBackup();
	
	public void setNbBackup(int nbBackup) throws ActiveObjectCreationException, NodeException, MigrationException;

	public List<Worker> getWorkers () throws ActiveObjectCreationException, NodeException, MigrationException;
	
	public void freeWorkers (ArrayList<Worker> workers) throws ActiveObjectCreationException, NodeException, MigrationException;

	
	/*
	
	public void addWorker (Worker w) throws ActiveObjectCreationException, NodeException, MigrationException;
	
	public void delWorker (Worker w);
	
	public void setMaster (Master m); // protected ?
	
	public ArrayList<Backup> getBackups();

	public void setBackups (ArrayList<Backup> list);
	
	public int getNbBackup();
	
	*/

}
